//
//  WQ_NavigationViewController.swift
//  xinlang
//
//  Created by 联创—王增辉 on 2019/3/18.
//  Copyright © 2019年 lcWorld. All rights reserved.
//

import UIKit

class WQ_NavigationViewController: UINavigationController,UINavigationControllerDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()
//        navigationBar.isHidden = true
    }
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if viewControllers.count > 0 {
            let item = UIButton()
            item.setTitle("返回", for: .normal)
            item.setTitleColor(UIColor.gray, for: .normal)
            item.setImage(UIImage.init(named: "navigationbar_back_withtext"), for: .normal)
            item.addTarget(self, action: #selector(backAvtion), for: UIControl.Event.touchUpInside)
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: item)
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
    @objc func backAvtion(){
        popViewController(animated: true)
    }

}
